package mlz.c_genericity.d_wild;

import java.util.ArrayList;
import java.util.Collection;

//通配符的上限与下限
public class Demo02 {
    public static void main(String[] args) {
        Collection<Integer> list1  = new ArrayList<>();
        Collection<String> list2 = new ArrayList<>();
        Collection<Number> list3 = new ArrayList<>();
        Collection<Object> list4 = new ArrayList<>();

        //泛型的上限
        getElement1(list1);
        //getElement1(list2);
        getElement1(list3);
        //getElement1(list4);

        //下限
        //getElement2(list1);
        //getElement2(list2);
        getElement2(list3);
        getElement2(list4);


    }

    //泛型的上限
    public static void getElement1(Collection<? extends Number> coll){

    }

    //泛型的下限
    public static void getElement2(Collection<? super Number> coll){

    }

}









